#!/bin/bash
# author: mmatczuk

function count {
	local lines=0
	for file in $(find $1 -name "*.java")
	do 
		let lines=$lines+$(wc -l $file | cut -d ' ' -f 1)	
	done
	echo $lines
}

cd $(dirname "${0}")
codedir="$(pwd)/CODE"

declare -i total=0
for module in $(find "${codedir}" -maxdepth 1 -type d -iname mas-*)
do
	ml=$(count $module)
	total=total+$ml
	echo $module: $ml 
done

echo
echo total: $total

